package com.bone.payment.po;

import java.io.Serializable;
import java.util.Date;

import com.bone.constant.Constant;
import com.bone.constant.PayPaymentConstant;
import com.bone.payment.utils.SerialUtil;
import com.bone.util.PriceUtil;

public class PayPayment implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7386889494160430210L;

	/**
	 * 
	 */
	private Long paymentId;
	/**
	 * 流水号.
	 */
    private String serialNo;
    /**
     * 业务类型(哪个业务类型(自由行/代售)).
     */
	private String bizType;
	/**
	 * 对象ID.
	 */
	private Long objectNo;
	/**
	 * 对象类型(订单).
	 */
	private String objectType;
	/**
	 * 
	 */
	private String paymentType;
	
	/**
	 * 支付网关(渠道).
	 */
	private String paymentGateway;
	/**
	 * 支付金额.
	 */
	private Long amount;
	/**
	 * 支付状态(CREATE,PRE_SUCCESS,CANCEL,SUCCESS,FAIL).
	 */
	private String status;
	/**
	 * 回馈时间.
	 */
	private Date callbackTime;
	/**
	 * 支付回馈信息.
	 */
	private String callbackInfo;
	/**
	 * 创建时间.
	 */
	private Date createTime;
	/**
	 * 支付网关交易流水号.
	 */
	private String gatewayTradeNo;
	/**
	 * 
	 */
	private String refundSerial;
	/**
	 * 发出去的交易流水号.
	 */
	private String paymentTradeNo;
	/**
	 * 是否已通知业务系统.
	 */
	private String notified;
	/**
	 * 操作人(SYSTEM/CSxxx/LVxxx).
	 */
	private String operator;
	/**
	 * 通知时间.
	 */
	private Date notifyTime;
	
	
	/**
	 * 
	 */
	public String geneSerialNo() {
		return SerialUtil.generate24ObjectId(objectNo);
	}
	public boolean isSuccess(){
		return status.equalsIgnoreCase(PayPaymentConstant.PAYMENT_SERIAL_STATUS.SUCCESS.name());
	}
	
	/**
	 * 
	 * @return
	 */
	public boolean orderPayment() {
		return "SUPER".equals(bizType);
	}
	
	public Long getPaymentId() {
		return paymentId;
	}
	public void setPaymentId(Long paymentId) {
		this.paymentId = paymentId;
	}
	public String getSerialNo() {
		return serialNo;
	}
	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}
	public Long getObjectNo() {
		return objectNo;
	}
	public void setObjectNo(Long objectNo) {
		this.objectNo = objectNo;
	}
	public String getObjectType() {
		return objectType;
	}
	public void setObjectType(String objectType) {
		this.objectType = objectType;
	}
	public String getObjectTypeZh() {
		return Constant.PAYMENT_BIZ_TYPE.getCnName(this.getObjectType());
	}

	public String getPaymentType() {
		return paymentType;
	}
	public void setPaymentType(String paymentType) {
		this.paymentType = paymentType;
	}
	public String getPaymentGateway() {
		return paymentGateway;
	}
	public void setPaymentGateway(String paymentGateway) {
		this.paymentGateway = paymentGateway;
	}
	public String getPaymentGatewayZh() {
		return Constant.PAYMNET_GATEWAY.getCnName(this.getPaymentGateway());
	}
	
	
	public Long getAmount() {
		return amount;
	}
	public void setAmount(Long amount) {
		this.amount = amount;
	}
	/**
	 * 获取订单金额(元).
	 * @return
	 */
	public float getAmountYuan() {
		if (amount != null) {
			return PriceUtil.convertToYuan(amount.longValue());
		}
		return 0.0F;
	}
	
	
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getStatusZh() {
		return PayPaymentConstant.PAYMENT_SERIAL_STATUS.getCnName(status);
	}
	
	
	public Date getCallbackTime() {
		return callbackTime;
	}
	public void setCallbackTime(Date callbackTime) {
		this.callbackTime = callbackTime;
	}
	public String getCallbackInfo() {
		return callbackInfo;
	}
	public void setCallbackInfo(String callbackInfo) {
		this.callbackInfo = callbackInfo;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getGatewayTradeNo() {
		return gatewayTradeNo;
	}
	public void setGatewayTradeNo(String gatewayTradeNo) {
		this.gatewayTradeNo = gatewayTradeNo;
	}
	public String getPaymentTradeNo() {
		return paymentTradeNo;
	}
	public void setPaymentTradeNo(String paymentTradeNo) {
		this.paymentTradeNo = paymentTradeNo;
	}
	public String getNotified() {
		return notified;
	}
	public void setNotified(String notified) {
		this.notified = notified;
	}
	public String getOperator() {
		return operator;
	}
	public void setOperator(String operator) {
		this.operator = operator;
	}
	public Date getNotifyTime() {
		return notifyTime;
	}
	public void setNotifyTime(Date notifyTime) {
		this.notifyTime = notifyTime;
	}
	public String getBizType() {
		return bizType;
	}
	public void setBizType(String bizType) {
		this.bizType = bizType;
	}
	public String getRefundSerial() {
		return refundSerial;
	}
	public void setRefundSerial(String refundSerial) {
		this.refundSerial = refundSerial;
	}
	 
	
}
